<%@page import="java.awt.print.Printable"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<title>_${customer.customerName}_灯光拣选任务列表</title>
<script language="javascript" type="text/javascript" src="${ctx}/static/datepicker/WdatePicker.js"></script>
<script type="text/javascript">
 
  //领取任务 
  function takeTask(taskId){
	  $.ajax({
			type:'post',
			url:'${ctx}/lampPickTask/ajaxTakeLampPickTask',
			data:{
				taskId:taskId
			},
			dataType:'json',
			success:function(data) {
			    if(data==true){
			      $("#queryForm").submit();
			    }else{
			      alert("网络繁忙，请稍后重试...");
			    }
			},
			error:function() {
				alert("网络繁忙，请稍后重试...");
			}
	   });
  }
  

</script>
</head>

<body>
<section class="content">
<div class="row">
		<div class="col-md-12">

			<!-- Primary box -->
			<div class="box box-solid box-primary">
				<div class="box-header">
					<i class="fa fa-edit"></i>
					<h3 class="box-title">我的灯光拣选任务</h3>
					<div class="box-tools pull-right">
						<button class="btn btn-primary btn-sm" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
					</div>
				</div>
				<div class="box-body">
				
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
<!-- 	    <thead> -->
<!-- 			<th style="vertical-align: middle; color: white; " colspan="13" bgcolor="#8EB4CB">我的灯光拣选任务</th> -->
<!-- 		</thead> -->
		<thead><tr>
			    <th>序号</th>
			    <th>作业仓库</th>
			    <th>任务编号</th>
			    <th>批次类型</th>
			    <th>批次编号</th>
			    <th>运单类型</th>
			    <th>作业类型</th>
			    <th>拣货类型</th>
			    <th>订单数量</th>
			    <th>创建时间</th>
			    <th>任务执行人</th>
			    <th>任务状态</th>
			    <th>操作</th>
			</tr></thead>
		<tbody>
		<c:forEach items="${myLampPickTaskList}" var="t" varStatus="i">
			<tr>
			   <td>${i.count}</td>
			   <td>${t.warehouseCode}</td>
			   <td>${t.taskCode}</td>
			   <td>
			    <c:if test="${t.batchType eq 'wms'}">商发宝</c:if>
			    <c:if test="${t.batchType eq 'tms'}">集发宝</c:if>
			    <c:if test="${t.batchType eq 'bms'}">分仓宝</c:if>
			   </td>
			   <td>${t.batchCode}</td>
			   <td>
			    <c:if test="${t.billType eq 'cbill'}">普通运单</c:if>
			    <c:if test="${t.billType eq 'ebill'}">电子运单</c:if>
			   </td>
			   <td>
			     <c:if test="${t.flowType eq 'prePrint'}">预先打单</c:if>
			     <c:if test="${t.flowType eq 'intimePrint'}">及时打单</c:if>
			  </td>
			   <td>
			     <c:if test="${t.pickType eq 'single'}">单件</c:if>
			     <c:if test="${t.pickType eq 'multi'}">多件
			         <c:if test="${t.pickModel eq 'lamp'}"><font color=blue>【灯光拣选】</font></c:if>
			         <c:if test="${t.pickModel eq 'car'}"><font color=red>【推车拣选】</font></c:if>
			     </c:if>
			   </td>
			   <td>${t.orderQty}</td>
			   <td>${fn:substring(t.createTime,0,19)}</td>
			   <td>${t.picker.realname}</td>
			   <td>
			     <c:if test="${t.status eq '1'}">创建任务</c:if>
			     <c:if test="${t.status eq '2'}">已分配拣货任务</c:if>
			     <c:if test="${t.status eq '3'}">已拣货</c:if>
			     <c:if test="${t.status eq '4'}">已分配灯光拣选任务</c:if>
			     <c:if test="${t.status eq '5'}">已经灯光拣选</c:if>
			     <c:if test="${t.status eq '6'}">已分配包装任务</c:if>
			     <c:if test="${t.status eq '7'}">已包装</c:if>
			     <c:if test="${t.status eq '8'}">已分配发货任务</c:if>
			     <c:if test="${t.status eq '9'}">已发货</c:if>
			     <c:if test="${t.status eq '10'}">任务进行中...</c:if>
			   </td>
			   <td>
			      <c:if test="${t.status eq '4'}">
			         <a href="${ctx}/lampPickTask/v2_toLampPickTaskPage/${t.id}" role="button"  class="btn btn-primary" >执行任务</a>
			      </c:if>
			      
			      <c:if test="${t.status eq '10'}">
			         <a href="${ctx}/lampPickTask/v2_toLampPickTaskPage/${t.id}" role="button"  class="btn btn-primary" >继续任务</a>
			      </c:if>
			      
			      <c:if test="${t.status ne '4' and t.status ne '10'}">
			         <a href="${ctx}/lampPickTask/v2_toLampPickTaskPage/${t.id}" role="button"  class="btn btn-info" >查看任务</a>
			      </c:if>
			      
			   </td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	</div></div></div></div>
	
<div class="row">
		<div class="col-md-12">

			<!-- Primary box -->
			<div class="box box-solid box-primary">
				<div class="box-header">
					<i class="fa fa-edit"></i>
					<h3 class="box-title">未分配的灯光拣选任务</h3>
					<div class="box-tools pull-right">
						<button class="btn btn-primary btn-sm" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
					</div>
				</div>
				<div class="box-body">
				
	<!-- 未分配的灯光拣选任务 -->
	<form class="form-search" id="queryForm" method="post" action="${ctx}/lampPickTask/v2_queryLampPickTaskList" style="margin-top: 10px;">
				 
				  <div class="form-group row">
				 <div class="col-sm-3">
					<div class="input-group col-sm-12">
						<span class="input-group-text"> 商家用户：</span> 
						<select class="form-control required"  id="_customerCode" name="_customerCode"  value="${param._customerCode}" onchange="ajaxAreaGroup(this,'_warehouseCode');">
					        <option value=""></option>
							<c:forEach items="${customerList}" var="customer">
								<option value="${customer.customerCode}"
								  <c:if test="${customerCode eq customer.customerCode }">selected=selected</c:if>
								>${customer.customerName}</option>
							</c:forEach>
					</select>  
					</div>
				</div>
				
				
				 <div class="col-sm-3">
					<div class="input-group col-sm-12">
						<span class="input-group-text"> 作业仓库 ：</span> 
						<select  name="_warehouseCode"  id="_warehouseCode" value="${param._warehouseCode}"  class="form-control">
							<option value=""></option>
							<c:forEach items="${warehouseList}" var="w">
								<option value="${w.groupCode}"
								<c:if test="${_warehouseCode eq w.groupCode}">selected=selected</c:if>
								>${w.groupName}</option>
							</c:forEach>
						</select>
					</div>
				</div>
				
				 <div class="col-sm-6">
			    <button class="btn btn-primary" type="submit" ">搜索</button>
			    </div>
			    </div>
		    </form>
	<table class="table table-striped table-bordered table-condensed" ">
<!-- 		<thead> -->
<!-- 			<th style="vertical-align: middle; color: white; " colspan="13" bgcolor="#8EB4CB">未分配的灯光拣选任务</th> -->
<!-- 		</thead> -->
		<thead><tr>
			    <th>序号</th>
			    <th>作业仓库</th>
			    <th>任务编号</th>
			    <th>批次类型</th>
			    <th>批次编号</th>
			    <th>运单类型</th>
			    <th>作业类型</th>
			    <th>拣货类型</th>
			    <th>订单数量</th>
			    <th>创建时间</th>
			    <th>任务执行人</th>
			    <th>任务状态</th>
			    <th>操作</th>
			</tr></thead>
		<tbody>
		<c:forEach items="${untakedLampPickTaskList}" var="t" varStatus="i">
			<tr>
			   <td>${i.count}</td>
			   <td>${t.warehouseCode}</td>
			   <td>${t.taskCode}</td>
			   <td>
			    <c:if test="${t.batchType eq 'wms'}">商发宝</c:if>
			    <c:if test="${t.batchType eq 'tms'}">集发宝</c:if>
			    <c:if test="${t.batchType eq 'bms'}">分仓宝</c:if>
			   </td>
			   <td>${t.batchCode}</td>
			   <td>
			    <c:if test="${t.billType eq 'cbill'}">普通运单</c:if>
			    <c:if test="${t.billType eq 'ebill'}">电子运单</c:if>
			   </td>
			   <td>
			     <c:if test="${t.flowType eq 'prePrint'}">预先打单</c:if>
			     <c:if test="${t.flowType eq 'intimePrint'}">及时打单</c:if>
			  </td>
			   <td>
			     <c:if test="${t.pickType eq 'single'}">单件</c:if>
			     <c:if test="${t.pickType eq 'multi'}">多件
			         <c:if test="${t.pickModel eq 'lamp'}"><font color=blue>【灯光拣选】</font></c:if>
			         <c:if test="${t.pickModel eq 'car'}"><font color=red>【推车拣选】</font></c:if>
			     </c:if>
			   </td>
			   <td>${t.orderQty}</td>
			   <td>${fn:substring(t.createTime,0,19)}</td>
			   <td></td>
			   <td><font color=red>未分配灯光拣选任务</font></td>
			   <td>
			      <input type="button" class="btn btn-primary" onclick="takeTask('${t.id}');" value="领取任务"/>
			   </td>
			</tr>
		</c:forEach>
		</tbody>
		
	</table>
	</div>
	</div>
	</div>
	</div>
	
</section>	

</body>
</html>
